<template class="task-template">
  <section id="pdf-section" class="section js-section u-category-media">
    <header class="section-header">
      <div class="section-wrapper">
        <h1>
          <svg class="section-icon"><use xlink:href="assets/img/icons.svg#icon-media"></use></svg>
          Print to PDF
        </h1>
        <h3>The <code>browser window</code> module in Electron has a property, <code>webContents</code>, which allows your app to print as well as print to PDF.</h3>

        <p>Open the <a href="http://electron.atom.io/docs/api/web-contents/#webcontentsprintoptions">full API documentation<span class="u-visible-to-screen-reader">(opens in new window)</span></a> in your browser.</p>
      </div>
    </header>

    <div class="demo">
      <div class="demo-wrapper">
        <button id="print-pdf-demo-toggle" class="js-container-target demo-toggle-button">Print to PDF
          <div class="demo-meta u-avoid-clicks">Supports: Win, macOS, Linux</div>
        </button>
        <div class="demo-box">
          <div class="demo-controls">
            <button class="demo-button" id="print-pdf">View Demo</button>
            <span class="demo-response is-selectable" id="pdf-path"></span>
          </div>
          <p>To demonstrate the print to PDF functionality, the demo button above will save this page as a PDF and, if you have a PDF viewer, open the file.</p>
          <p>In a real-world application you're more likely to add this to application menu, but for the purposes of the demo we've set it to the demo button.</p>
          <h5>Renderer Process</h5>
          <pre><code data-path="renderer-process/media/pdf.js"></code></pre>
          <h5>Main Process</h5>
          <pre><code data-path="main-process/media/pdf.js"></code></pre>

          <div class="demo-protip">
            <h2>ProTip</h2>
            <strong>Use a print style sheet.</strong>
            <p>You can create a stylesheet targeting printing to optimize the look of what your users print. Below is the stylesheet used in this app, located in <code>assets/css/print.css</code>.</p>
            <pre><code data-path="assets/css/print.css"></code></pre>
          </div>
        </div>
      </div>
    </div>

    <script type="text/javascript">
      require('./renderer-process/media/pdf')
    </script>

  </section>
</template>
